package com.demo.controller;

import com.base.controller.BaseController;
import com.base.model.ResultCode;
import com.demo.model.Dog;
import com.demo.service.DogService;
import com.google.gson.Gson;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Comments：
 * Author：yuxin
 * Create Date：2017-07-13
 * Modified By：
 * Modified Date：
 * Why & What is modified：
 * Version：v1.0
 */
@Api(value = "dog类")
@RestController
@RequestMapping(value = "/Dog")
public class DogController extends BaseController {
    private static final Gson gson = new Gson();
    @Autowired
    DogService dogService;


    @ApiOperation(value = "增加一只dog")
    @RequestMapping(method = RequestMethod.POST,value = "addDog")
    public String addDog(@RequestBody Dog dog) {
        int num=dogService.addDog(dog);
        if(num>0){
            return responseSuccess(dog);
        }
        return responseFail(ResultCode.MSG_ERROR);
    }
}
